package com.aq.front.action;

import java.util.Collection;

import com.aq.front.service.IFrontService;
import com.hs.common.page.PageParam;
import com.hs.common.page.PageUtil;
import com.hs.core.action.AbstractAction;

public class FrontAction extends AbstractAction {
	

	private static final long serialVersionUID = 7505657452596849825L;

	private IFrontService frontService;  

    protected Collection caseItems;
    protected Collection messageItems;
    protected Collection newsItems;
    protected Collection productItems;
    protected Collection SolvtionItems;
    
    protected PageUtil pageUtil;
    protected String pageStr;
    protected String type;
    
    
    
    
    public String listContent() throws Exception{
    	System.out.println("==============================###########"+getType());
    	PageParam pageParam = new PageParam(this.getHttpServletRequest(),"content.action");
    	//order   by   date   desc,type   asc,title   asc
		String aqNews = " from AqNews where 1=1 ORDER BY NEWSID desc";
		pageParam.setSearchSql(aqNews);
		pageUtil = frontService.getCaseList(pageParam);
		newsItems = pageUtil.getPageList();
			
        return SUCCESS; 
    	
    }
    
    public String listLeft()throws Exception{
    	PageParam pageParam = new PageParam(this.getHttpServletRequest(),"left.action");
    	String aqCase = " from AqCase where 1=1 ORDER BY PRODUCTID desc ";
		pageParam.setSearchSql(aqCase);
		pageUtil = frontService.getCaseList(pageParam);
		caseItems = pageUtil.getPageList();
    	 return SUCCESS; 
    }
    
    public String aboutContent(){
    	 return SUCCESS; 
    }
    
    
    
    public String aboutLeft(){
    	 return SUCCESS;
    }
    
    
    public String companyContent(){
    	PageParam pageParam = new PageParam(this.getHttpServletRequest(),"companycontent.action");
		
    	String aqNews = " from AqNews where 1=1 ORDER BY NEWSID desc";
		pageParam.setSearchSql(aqNews);
		pageParam.setPerPageCount(5);
		pageUtil = frontService.getCaseList(pageParam);
		newsItems = pageUtil.getPageList();
		pageStr = pageUtil.getPageStr();
		this.getHttpServletRequest().setAttribute("dataList", newsItems);
   	     return SUCCESS; 
   }
    
   
   public String companyLeft(){
   	    return SUCCESS;
   }
   
   
   public String customerContent(){
	   PageParam pageParam = new PageParam(this.getHttpServletRequest(),"customercontent.action");
   	   String aqCase = " from AqCase where 1=1 ORDER BY PRODUCTID desc ";
		pageParam.setSearchSql(aqCase);
		pageUtil = frontService.getCaseList(pageParam);
		caseItems = pageUtil.getPageList();
		pageStr = pageUtil.getPageStr();
		this.getHttpServletRequest().setAttribute("dataList", caseItems);
  	     return SUCCESS; 
  }
   
  
  public String customerLeft(){
  	    return SUCCESS;
  }
    
    

	/**
	 * @return the caseItems
	 */
	public Collection getCaseItems() {
		return caseItems;
	}

	/**
	 * @param caseItems the caseItems to set
	 */
	public void setCaseItems(Collection caseItems) {
		this.caseItems = caseItems;
	}

	/**
	 * @return the frontService
	 */
	public IFrontService getFrontService() {
		return frontService;
	}

	/**
	 * @param frontService the frontService to set
	 */
	public void setFrontService(IFrontService frontService) {
		this.frontService = frontService;
	}

	/**
	 * @return the messageItems
	 */
	public Collection getMessageItems() {
		return messageItems;
	}

	/**
	 * @param messageItems the messageItems to set
	 */
	public void setMessageItems(Collection messageItems) {
		this.messageItems = messageItems;
	}

	/**
	 * @return the newsItems
	 */
	public Collection getNewsItems() {
		return newsItems;
	}

	/**
	 * @param newsItems the newsItems to set
	 */
	public void setNewsItems(Collection newsItems) {
		this.newsItems = newsItems;
	}

	/**
	 * @return the productItems
	 */
	public Collection getProductItems() {
		return productItems;
	}

	/**
	 * @param productItems the productItems to set
	 */
	public void setProductItems(Collection productItems) {
		this.productItems = productItems;
	}

	/**
	 * @return the solvtionItems
	 */
	public Collection getSolvtionItems() {
		return SolvtionItems;
	}

	/**
	 * @param solvtionItems the solvtionItems to set
	 */
	public void setSolvtionItems(Collection solvtionItems) {
		SolvtionItems = solvtionItems;
	}

	/**
	 * @return the pageStr
	 */
	public String getPageStr() {
		return pageStr;
	}

	/**
	 * @param pageStr the pageStr to set
	 */
	public void setPageStr(String pageStr) {
		this.pageStr = pageStr;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(String type) {
		this.type = type;
	} 

}
